#pragma once
#include"RBTree.h"

namespace cyq
{
	template<class K>
	class set
	{
	public:
		struct KeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

		typedef typename RBTree<K, K, KeyOfT>::const_iterator iterator;
		typedef typename RBTree<K, K, KeyOfT>::const_iterator const_iterator;


		const_iterator begin() const
		{
			return _s.begin();
		}

		const_iterator end() const
		{
			return _s.end();
		}

		//返回的是const迭代器
		pair<iterator, bool>  Insert(const K& k)
		{
			//返回的是树中的普通迭代器
			pair<RBTree<K, K, KeyOfT>::iterator, bool> ret = _s.Insert(k);
			//用普通迭代器去构造const迭代器
			return pair<iterator, bool>(ret.first, ret.second);
		}

	private:
		RBTree<K, K, KeyOfT> _s;

	};
}
